package com.example.demo.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.example.demo.dao.UserDao;
import com.example.demo.entity.User;

@RestController
@RequestMapping
public class UserController {
	@Autowired
	UserDao userDao;

	@GetMapping("test")
	public List<User> getUserlist() {
		return userDao.findAll();
	}
	
	@GetMapping("age")
	public User getUserByAge() {
		return userDao.findByAge(18);
	}
}
